<?php

require_once './vendor/autoload.php';

$mysqlConfig = [
    'host'=>'127.0.0.1',
    'port'=>'3307',
    'dbname'=>'swoole_test',
    'username'=>'root',
    'password'=>'123456',
];

$configStr = "mysql:host={$mysqlConfig['host']};port={$mysqlConfig['port']};dbname={$mysqlConfig['dbname']}";

$pdo = new PDO($configStr,$mysqlConfig['username'],$mysqlConfig['password']);

$faker = \Faker\Factory::create('zh_CN');
$pdo->exec('set names utf8mb4');

for ($j=0;$j<100;$j++){
    $sql = 'INSERT test_order (`name`,`desc`) VALUES';
    $values = '';
    for ($i = 0;$i<10000;$i++){
        $values .= "('{$faker->name}','{$faker->text}'),";
    }
    $values = rtrim($values,',');
    $sql .=$values;
    $pdo->exec($sql);
}




echo "执行完成";